<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML PUBLIC "" "">
<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:w="http://www.apusic.com/jsf/widget" xmlns:layout="http://www.apusic.com/jsf/layout"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:ajax="http://www.apusic.com/jsf/ajax"
	xmlns:om="http://www.apusic.com/jsf/misc" renderKitId="AJAX" xmlns:epm="http://www.bp.com.cn/epm">
	<w:head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<w:stylesheet src="/css/kmp4.css" type="text/css"></w:stylesheet>
		<w:script src="/javascript/k4.js" type="text/javascript" language="UTF-8"></w:script>
		<script>
		 	//<![CDATA[
		 	function deleteConfirm(){
			if(departmentalUnitGridJsvar.getSelectionModel().getSelected()==null){
				alert("请选择一条记录！");
				return false;
			}
			return showConfirm('你确定要删除吗？');
		}
			function freshme(){
	 		var store=departmentalUnitGridJsvar.getStore();
			store.reload(store.lastOptions);
	 	}	
	 	 function clearSeach(){
	 	   codeJsvar.setValue('');
	 	   departmentNameJsvar.setValue('');
	 	   belongCentralUnitJsvar.setValue('');
	 	   }
		     //]]>
		 </script>
	</w:head>
	<w:page title="部门一览">
		<layout:panel border="false" autoHeight="true" autoWidth="true" header="false"
			styleClass="k4-view">
			<layout:panel id="viewtoolbar" border="false" autoHeight="true" autoWidth="true"
				styleClass="k4-form-toolbar">
				<w:form groupId="toolbarForm">
					<w:toolBar>
						<w:button label="编辑"
							image="#{facesContext.externalContext.requestContextPath}/images/edit.gif"
							id="editDepartmentalUnit" />
						<w:separator />
						<w:button label="删除"
							image="#{facesContext.externalContext.requestContextPath}/images/delete.gif"
							id="deleteDepartmentalUnit" onclick="return deleteConfirm();"/>
					</w:toolBar>
				</w:form>
			</layout:panel>
			<layout:panel title="搜索条件" border="false" autoHeight="true" autoWidth="true" collapsible="true"
				collapsed="false" styleClass="k4-view-search">
				<w:form>
					<layout:panelGrid columns="4" width="92%" cellpadding="0" border="1" cellspacing="0"
						styleClass="k4-form-grid">
						<layout:cell styleClass="k4-form-fieldtitle">
							<h:outputText value="部门编号" />
						</layout:cell>
						<layout:cell styleClass="k4-form-fieldvalue">
							<w:textField styleClass="k4-form-textfield" id="code" requiredTrim="true" jsvar="codeJsvar"></w:textField>
						</layout:cell>
						<layout:cell styleClass="k4-form-fieldtitle">
							<h:outputText value="部门名称" />
						</layout:cell>
						<layout:cell styleClass="k4-form-fieldvalue">
							<w:textField styleClass="k4-form-textfield" id="departmentName" requiredTrim="true"
								jsvar="departmentNameJsvar"></w:textField>
						</layout:cell>
						<layout:cell styleClass="k4-form-fieldtitle">
							<h:outputText value="所属机构" />
						</layout:cell>
						<layout:cell styleClass="k4-form-fieldvalue">
							<w:combo id="belongCentralUnit" editable="false" styleClass="k4-form-comofield"
								jsvar="belongCentralUnitJsvar"></w:combo>
						</layout:cell>
						<layout:cell colspan="2" styleClass="k4-form-fieldvalue">
							<layout:panelGrid columns="2" cellpadding="0" cellspacing="0">
								<w:button id="query" value="搜索"
									image="#{facesContext.externalContext.requestContextPath}/images/search.gif" />
								<w:button id="reset" value="重置"
									image="#{facesContext.externalContext.requestContextPath}/images/clear.gif"
									immediate="true" onclick="clearSeach();" />
							</layout:panelGrid>
						</layout:cell>
					</layout:panelGrid>
				</w:form>
				<w:dataGrid id="departmentalUnitGrid" toolBarPosition="bottom" rows="15" paged="true"
					border="false" showRowNumber="true" styleClass="k4-view-datagrid" autoHeight="true"
					singleSelect="true" jsvar="departmentalUnitGridJsvar">
					<ajax:action event="ondblclick"
						action="#{system_departmentalUnitListBean.showDepartmentalUnit}" />
					<!--<w:outputColumn width="60" align="center" clientFormatter="idFormatter" header="序号"></w:outputColumn>-->
					<w:outputColumn id="departmentCode" header="部门编号" width="150"></w:outputColumn>
					<w:outputColumn id="name" header="部门名称" width="300"></w:outputColumn>
					<w:outputColumn id="parentDepartmentalUnitId" header="上级部门" width="150"
						converter="departmentNameFormatter"></w:outputColumn>
					<w:outputColumn id="centralUnitId" header="所属机构" width="150" converter="orgNameFormatter"></w:outputColumn>
					<w:pagingToolbar for="departmentalUnitGrid" displayInfo="true" displayMsg="显示 {0} - {1}，共 {2} 条" />
				</w:dataGrid>
			</layout:panel>
		</layout:panel>
	</w:page>
</f:view>